import dayjs from "dayjs";
export default {
  //默认获取焦点
  focus: {
    mounted(el) {
      el.focus();
    },
  },
  lifeCycle: {
    created(el, binding, vnode, prevVnode) {
      console.log('created')
    },
    beforeMount(el, binding, vnode, prevVnode) {
      console.log('beforeMount')
    },
    mounted(el, binding, vnode, prevVnode) {
      console.log('mounted')
    },
    beforeUpdate(el, binding, vnode, prevVnode) {
      console.log('beforeUpdate')
    },
    updated(el, binding, vnode, prevVnode) {
      console.log('updated')
    },
    beforeUnmount(el, binding, vnode, prevVnode) {
      console.log('beforeUnmount')
    },
    unmounted(el, binding, vnode, prevVnode) {
      console.log('unmounted')
    },
  },
  //毫秒数转化成时间
  formateTime: {
    mounted(el, binding) {
      let formateString = 'YYYY-MM-DD HH:mm:ss'
      if (binding.value) {
        formateString = binding.value
      }
      el.textContent = dayjs(+el.textContent).format(formateString)
    }
  }
}